#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-

import oss2
import os, sys
# 阿里云账号AccessKey拥有所有API的访问权限，风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维，请登录RAM控制台创建RAM用户。
auth = oss2.Auth('LTAI5tGCjhHEoBYpvPQDkbj9', 'NF5Xw8X9CDuBjzbKQp3o5A64w2oA7s')
# Endpoint以杭州为例，其它Region请按实际情况填写。
bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'ubungit')
# oss2.resumable_upload(bucket, 'sqlite.db', '/Users/admin/Documents/stock/stockdate/sql/sqlite1.db')
def percentage(consumed_bytes, total_bytes):
    if total_bytes:
        rate = int(100 * (float(consumed_bytes) / float(total_bytes)))
        print('\r{0}% '.format(rate), end='')
        sys.stdout.flush()
oss2.resumable_upload(bucket, 'sqlite.db', '/Users/admin/Documents/stock/stockdate/sql/sqlite1.db',progress_callback=percentage)